
trait GetAge {
    fn get_age(&self) -> u32;
}

struct Student {
    name: String,
    age: u32,
}

struct Teacher {
    name: String,
    age: u32,
}

impl GetAge for Student {
    fn get_age(&self) -> u32 {
        self.age
    }
}

impl GetAge for Teacher {
    fn get_age(&self) -> u32 {
        self.age
    }
}

fn produce_item_with_age() -> Box<dyn GetAge> {
    let is = true;
    if is {
        return Box::new(Student {
            name: String::from("Tom"),
            age: 18,
        });
    }
    return Box::new(Teacher {
        name: String::from("Tom"),
        age: 18,
    });
}

fn main() {}
